<template>
	<view class="" style="width: 100vw;height: 100vh">
		<view class="" :style="{'background':kbackgroundColor2}" style="min-height: 100vh">
			<hx-navbar title="账单明细" :back="true" :fixed="false" :color="knavTitleColor"
				:style="{background:kbackgroundColor2}" barPlaceholder="hidden" transparent="auto"></hx-navbar>
			<view class="content">
				<view class="tabList">
					<view class="tab_box">
						<template v-for="(item, index) in tabList">
							<view class="tab_dd" :style="tabid==item.id? [selStyle]:[tabNormaleStyle]"
								  :class="{'tabActive':tabid==item.id}" :key="index"
								  @tap="tabClick(item.id)">
								<text>{{item.name}}</text>
							</view>
						</template>
					</view> 
					
					
					
					
				<!-- 	<view :style="{color:knavTitleColor}" v-for="(item,index) in tabList" :key="index">
						<view class="" @click="tabClick(item.id)" 
							:style="[{'borderBottom':(tabid==item.id) ? kborderSty :''},{'color':(tabid==item.id) ? ktopicAdaptationColors :''}]">
							{{item.name}}
						</view>
					</view> -->
				</view>
				<!-- 账单 -->
				<view v-if='tabid==1' class="box_bk"
					:class="[{'border_sel_box_black':ktheme =='black'},{'border_sel_box_purple':ktheme =='purple'}]">
					<view class="cont_mess" v-for="(item,index) in list" @click="detailClick(item)" :key="index">
				<!-- 1->充值 2->提现  3-> 支出  4->收入 -->
				<view class="type_img" style="background: #434343;" v-if="ktheme != 'purple'">
					<image class="t_img" v-if="item.transactionStatus==1" src="@/static/user/wallet/pay.png" mode="">
					</image>
				 <image class="t_img" v-if="item.transactionStatus==2 && item.type==2" src="@/static/user/wallet/full.png" mode="">
				 </image>
					<image class="t_img" v-if="item.transactionStatus==2 && item.type==1 " src="@/static/user/wallet/withdraw_deposit.png" mode="">
					</image>
					<image class="t_img" v-if="item.transactionStatus==3" src="@/static/user/wallet/pay.png" mode="">
					</image>
				</view>
				<view class="type_img" style="background:#EEEEEE" v-if="ktheme != 'black'">
					<image class="t_img" v-if="item.transactionStatus==1" src="@/static/user/wallet/pay_black.png" mode="">
					</image>
					<image class="t_img" v-if="item.transactionStatus==2 && item.type==2" src="@/static/user/wallet/full_black.png" mode="">
					</image>
					<image class="t_img" v-if="item.transactionStatus==2 && item.type==1" src="@/static/user/wallet/wallet-cash-icon-white.png"
						mode=""></image>
					<image class="t_img" v-if="item.transactionStatus==3" src="@/static/user/wallet/pay_black.png"
						mode=""></image>
				</view>
						<view class="" style="width: 52%;">
							<view class="name_detail" :style="{'color': (ktheme != 'purple' ? ' #dfdfdf':' #000000')}">
								<text v-if="item.type==1">提现</text>
								<text v-if="item.type==2">充值</text>
						
							</view>
							<view class="d_mess" :style="{'color': (ktheme != 'purple' ? ' #b9b9b9':' #000000')}">
									<text v-if="item.transactionStatus==1">处理中</text>
									<text v-if="item.transactionStatus==2">成功</text>
									<text v-if="item.transactionStatus==3">失败</text>
							</view>
							<view class="d_mess" :style="{'color': (ktheme != 'purple' ? ' #b9b9b9':' #000000')}">
								{{filterTime(item.createTime)}}
							</view>
						</view>
						<!--  1->充值 2->提现失败 3->提现成功4->支出 5->收入 -->
						<view class="money" style="width: 30%;text-align: right;" :style="{color:kselectColorSize}">
							<!-- 充值成功+提现失败  2-成功 3-失败 -->
							<text v-if="(item.transactionStatus==2  && item.type==2 )||( item.type==1 && item.transactionStatus==3)">+</text>
							<text v-if="item.transactionStatus==2  && item.type==1 ">-</text>
							{{item.amount}}
						</view>
					</view>
	<view style="text-align: center;" v-if="list.length == 0">
					<image src="@/static/without.png" style="width:550rpx;margin: 10rpx auto " alt="" mode="widthFix">
					</image>
					<!-- 	<image src="/static/user/none_img2.png" mode="widthFix"></image> -->
				</view>
				</view>
		<!-- 交易 -->
		<view  v-if='tabid==2' class="box_bk"
				:class="[{'border_sel_box_black':ktheme =='black'},{'border_sel_box_purple':ktheme =='purple'}]">
				<view class="cont_mess" v-for="(item,index) in pyaList" @click="detailClick(item)"  :key="index">
				<view class="type_img" style="background: #434343;" v-if="ktheme != 'purple'">
					<image class="t_img" v-if="item.changeType==1" src="@/static/user/wallet/pay.png" mode="">
					</image>
					<image class="t_img" v-if="item.changeType==2" src="@/static/user/wallet/pay.png" mode="">
					</image>
					<image class="t_img" v-if="item.changeType==3" src="@/static/user/wallet/more.png" mode="">
					</image>
					<image class="t_img" v-if="item.changeType==4" src="@/static/user/wallet/send.png" mode="">
					</image>
				</view>
				<view class="type_img" style="background:#EEEEEE" v-if="ktheme != 'black'">
					<image class="t_img" v-if="item.changeType==1" src="@/static/user/wallet/pay_black.png" mode="">
					</image>
					<image class="t_img" v-if="item.changeType==2" src="@/static/user/wallet/pay_black.png" mode="">
					</image>
					<image class="t_img" v-if="item.changeType==3" src="@/static/user/wallet/more_black.png"
						mode=""></image>
					<image class="t_img" v-if="item.changeType==4" src="@/static/user/wallet/send_black.png"
						mode=""></image>
				</view>
					 <view class="" style="width: 52%;">
						<view class="name_detail" :style="{'color': (ktheme != 'purple' ? ' #dfdfdf':' #000000')}">
								{{item.changeReason}}
						
						</view>
						<view class="d_mess" :style="{'color': (ktheme != 'purple' ? ' #b9b9b9':' #000000')}">
							<!-- 	<text v-if="item.changeType==1">处理中</text>
								<text v-if="item.changeType==2">成功</text>
								<text v-if="item.changeType==3">失败</text> -->
						</view>
						<view class="d_mess" :style="{'color': (ktheme != 'purple' ? ' #b9b9b9':' #000000')}">
							{{filterTime(item.createTime)}}
						</view>
					</view>
					<!-- 1 、4  +  2、3 - -->
					<view class="money" style="width: 30%;text-align: right;" :style="{color:kselectColorSize}">
						<text v-if="item.changeType==1 || item.changeType==4">+</text>
						<text v-if="item.changeType==2 || item.changeType==3">-</text> 
						<text v-if="item.changeType==3 || item.changeType==4">	{{item.changeAmount}}</text>
						<text v-else>{{item.changeAmount}}</text>
						<!-- {{item.changeAmount}} -->
					</view>
				</view>
		<view style="text-align: center;" v-if="pyaList.length == 0">
			<image src="@/static/without.png" style="width:550rpx;margin: 10rpx auto " alt="" mode="widthFix">
			</image>
			<!-- 	<image src="/static/user/none_img2.png" mode="widthFix"></image> -->
		</view>
			</view>
		
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				tabList: [{
					id: 1,
					name: '充值提现'
				}, {
					id: 2,
					name: '交易明细'
				}],
				tabid: 1,
			qblist: {},
				list: [],
				page: 1,
				limit: 10,
				hasNextPage: true,
	      pyaList: [],
		  page2: 1,
		  limit2: 10,
		  hasNextPage2: true,

			}
		},
		onPullDownRefresh() {
			setTimeout(function() {
				uni.stopPullDownRefresh()
			}, 1000)
			this.getlist()
			this.getPaylist()
			
		},
		onReachBottom() {
			if(this.tabid==1){
				if (this.hasNextPage) {
				this.page = this.page + 1
					this.$api.purseExtractTopupList(this.page, val => {
						if (val.status) {
							this.list = this.list.concat(val.data.list)
							this.hasNextPage = val.data.list.length >= this.limit;
						} else {
							this.$common.errorToShow(val.message)
						}
				
					})
				}
			}else{
				if (this.hasNextPage2) {
					  this.page2 = this.page2 + 1
				this.$api.purseChangeDetailList(this.page2, val => {
					if (val.status) {
						this.pyaList = this.pyaList.concat(val.data.list) //全部展示
					this.hasNextPage2 = val.data.list.length >= this.limit;
					} else {
						this.$common.errorToShow(val.message)
					}
				})
				}
			}
			
		},
		onLoad() {
		 this.getlist()
			this.getPaylist()
		},
		methods: {
			detailClick(item){
				var list= encodeURIComponent(JSON.stringify(item));
				uni.navigateTo({
					url: '/pages/user/wallet/draw-cash-result?id=' + item.id + '&type='+this.tabid+'&list='+list
				})
				
			
			},
			filterTime(val) {
				return this.$common.filterTime(val);
			},
			getPaylist() {
				//明细
				this.pyaList = [],
					this.page2 = 1;
				this.hasNextPage2 = true;
				this.$api.purseChangeDetailList(this.page2, val => {
					if (val.status) {
						this.pyaList = val.data.list //全部展示
					this.hasNextPage2 = val.data.list.length >= this.limit;
					} else {
						this.$common.errorToShow(val.message)
					}


				})
			},
		getlist() {
				//明细
				this.list = [],
					this.page = 1;
				this.hasNextPage = true;
				this.$api.purseExtractTopupList(this.page, val => {
					if (val.status) {
						this.list = val.data.list //全部展示
					this.hasNextPage = val.data.list.length >= this.limit;
					} else {
						this.$common.errorToShow(val.message)
					}
			
			
				})
			},
			
			getlist() {
				//明细
				this.list = [],
					this.page = 1;
				this.hasNextPage = true;
				this.$api.purseExtractTopupList(this.page, val => {
					if (val.status) {
						this.list = val.data.list //全部展示
					this.hasNextPage = val.data.list.length >= this.limit;
					} else {
						this.$common.errorToShow(val.message)
					}


				})
			},
			tabClick(index) {
				this.tabid = index
				// if (index == 1) {
				// } else if (index == 2) {
				// }
			}

		}
	}
</script>

<style scoped lang="scss">
	.content {
		margin: auto;
	}

	.box_bk {
		margin: auto;
		width: 690rpx;
		min-height: 1000rpx;
		margin-top: 33rpx;
		padding: 25rpx 18rpx;
		border-radius: 10rpx;
		border: 4rpx solid transparent;
		font-size: 26rpx;
	}

	.border_sel_box_black {
		color: white;
		width: 690rpx;
		border: 4rpx solid transparent;
		background-clip: padding-box, border-box;
		background-origin: padding-box, border-box;
		border-radius: 20rpx;
		background-image: linear-gradient(to bottom, #000000, #0b0b0b), linear-gradient(180deg, #F5F97F, #55CC7C);
		// padding: 10rpx 24rpx;
	}

	.border_sel_box_purple {
		color: #000;
		width: 687rpx;
		border: 4rpx solid transparent;
		background-clip: padding-box, border-box;
		background-origin: padding-box, border-box;
		border-radius: 20rpx;
		background-image: linear-gradient(to bottom, #ffffff, #ffffff), linear-gradient(0deg, #7776FF, #AE2CF1);
	}

	.box_mess {
		display: flex;
		margin-top: 32rpx;
		align-items: center;

	}

	.tabList {
		margin: 20rpx;
		height: auto;
		display: flex;
		justify-content: space-around;

		.btntk {
			width: 198rpx;
			height: 80rpx;
			margin: 10rpx auto;
			border-radius: 44rpx;
			display: flex;
			align-items: center;
			justify-content: center;
			font-size: 32rpx;
			font-weight: 400;
		}
	}

	.cont_mess {
		font-weight: 500;
		font-size: 28rpx;
		margin: 20rpx auto;
		width: 630rpx;
		height: 200rpx;
		display: flex;
		padding: 25rpx 25rpx;
		justify-content: space-between;
		align-items: center;
		border-bottom: 1rpx solid #898989;

		.mess_list {
			width: 30%;

			.m-img {
				width: 20%;
			}
		}

		.detail_mess {
			position: relative;
			color: #fff;
			border-radius: 100rpx;
		}

		.detail_mess::after {
			content: "";
			position: absolute;
			bottom: -2rpx;
			left: 0;
			width: 100%;
			height: 8rpx;
			/* 线条的高度 */
			background: linear-gradient(135deg, #5bd680ff 0%, #0bff5c51 50%, #000000 100%);
		}

		.detail_mess2 {
			position: relative;
			color: #000;

		}

		.detail_mess2::after {
			content: "";
			position: absolute;
			bottom: -2rpx;
			left: 0;
			width: 100%;
			height: 8rpx;
			/* 线条的高度 */
			background: linear-gradient(135deg, #AD56D7 0%, #e199ff 50%, #ffffff 100%);
		}

		.rimg {
			width: 28rpx;
			margin-left: 20rpx;

		}


	}

	.type_img {
		width: 74rpx;
		height: 74rpx;
		border-radius: 50%;
		text-align: center;
		line-height: 94rpx;

		.t_img {
			width: 38rpx;
			height: 38rpx;

		}
	}
	.tab_box {
			width: 100%;
			// padding: 30rpx 70rpx 0;
			display: flex;
			align-items: center;
			// justify-content: space-between;
			justify-content: space-around;
			height: 88rpx;
			.tab_dd {
				font-size: 32rpx;
				color: var(--tabNormalColor);
				font-weight: 400;
				position: relative;
			}
		
			.tabActive {
				color: var(--selectColorSize);
				font-weight: bold;
			}
		
			.tabActive::after {
				display: block;
				clear: both;
				content: '';
				width: 65%;
				height: 10rpx;
				// background:red;
				background: var(--selBcakborder);
				border-radius: 100rpx;
				position: absolute;
				left: 50%;
				bottom: -16rpx;
				transform: translateX(-50%);
			}
		}
	
</style>